<?php
class AOrdenTrabajoOperaciones {

	public function __construct() {
	}

	public function inicia(EFacade & $facade) {

		$docOTA = & $facade->getDocumentRoot();
		$role=NULL;
			//Disparar la OM
//		$OM = $docOTA->ordenMantenimiento;
//		$workflow = & $OM->getWorkflowRef();
//		$facade->session->refresh($workflow);
//		$newEfacade = & EFacade :: initWorkflowWithoutRole($facade->session, $OM, 3);//tipo Process
//		$transSet = & EFacade :: getCurrentTransSetAuto($workflow, /*PROCESS */ 3);
//		$trans = $transSet->getTransByName('t12');
//		$role = null;
//		//Solo si esta disponible la t15
//		if($trans){
//			$newEfacade->fireTrans($trans, $role, "Culmina",TRUE);
//			$workflow->epSetDirty(TRUE);
//			$OM->epSetDirty(TRUE);
//			$newEfacade->saveWorkflow();
//		}

		//Disparo el agente en t3 de la OTA
		$docOTA->epSetDirty(TRUE);
	   	$usuario=NULL;
		$workflowSA = & $facade->getWorkflow();
		$workflowSA->epSetDirty(TRUE);
		$transSetSA = & EFacade :: getCurrentTransSetAuto($workflowSA, 2); //TYPE AUTO AGENT
		
		$transSA = $transSetSA->getTransByName('t4');
		$facade->fireTrans($transSA,$usuario,'Disparar', TRUE);
		$facade->saveWorkflow();
	}
}
?>